home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group99a.txt / 000229_icon-group-sender _Wed Nov 10 09:44:51 1999.msg < prev    next >
Internet Message Format  |  2000-09-20  |  5KB

  1. Return-Path: <icon-group-sender>
  2. Received: (from root@localhost)
  3.     by baskerville.CS.Arizona.EDU (8.9.1a/8.9.1) id JAA29118
  4.     for icon-group-addresses; Wed, 10 Nov 1999 09:42:51 -0700 (MST)
  5. Message-Id: <199911101642.JAA29118@baskerville.CS.Arizona.EDU>
  6. X-Authentication-Warning: agate.berkeley.edu: news set sender to <news> using -f
  7. From: Anders Holtsberg <andersh@maths.lth.se>
  8. X-Newsgroups: comp.lang.icon
  9. Subject: List question
  10. Date: Wed, 10 Nov 1999 10:17:23 +0100
  11. X-Accept-Language: en
  12. To: icon-group@optima.CS.Arizona.EDU
  13. Errors-To: icon-group-errors@optima.CS.Arizona.EDU
  14. Status: RO
  15.  
  16.  
  17. --------------2D064CE7C06019CDC4A897F9
  18. Content-Type: text/plain; charset=us-ascii
  19. Content-Transfer-Encoding: 7bit
  20.  
  21.  
  22. A string can be changed in place
  23.  
  24.    s[4:6] = " hello "
  25.  
  26. A list can be appended at the end and at the beginning
  27.  
  28.   every put(listA, !listB)
  29.  
  30. But does the language definition forbid
  31.  
  32.   listA[5+:0] := listB
  33.  
  34. or what is the handy way to delete and insert elements
  35. in a list supplied as an argument? If I have
  36.  
  37.   procedure f(mylist)
  38.  
  39.      put(mylist, "hello") # This is OK
  40.      mylist[5+:0] := ["hello"] # Run time error. The book states
  41.     #  that run time error is indeed expected.
  42.      mylist := mylist[1:5] ||| ["hello"] ||| mylist[5:0]  # Here the
  43. caller is not affected!
  44.  
  45. 1) Have I understood? Is it impossible to write a routine
  46. listinsert(A,B,i)
  47.      and that we have to write A:=listinsert(A,B,i)
  48. 2) What was the language design objectives to rule out
  49.             listA[i:j] := listB
  50.       There is no semantic problem , listA[i] is an element and
  51. listA[i+:1] is a
  52.       sublist (or rather today only a list of its own since it cannot be
  53. a left-value).
  54. 3) I figure there are dark corners here since I saw in a list library
  55. that
  56.      mr Griswold himself thought about the difficulties in
  57. similarity/differences
  58.      between string filosophy and list filosophy.
  59.  
  60. Comments anybody?
  61.  
  62. (the code is from top of my head, I only have Icon at home just now)
  63.  
  64. Andy
  65.  
  66. --
  67. __________________________________________________________________
  68. Anders Holtsberg        Matematisk statistik   Telefon 046-2224953
  69. andersh@maths.lth.se    Matematikcentrum       Telefax 046-2224998
  70. www.maths.lth.se        Lunds universitet      Box 118, 22100 Lund
  71.  
  72.  
  73.  
  74. --------------2D064CE7C06019CDC4A897F9
  75. Content-Type: text/html; charset=us-ascii
  76. Content-Transfer-Encoding: 7bit
  77.  
  78. <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
  79. <html>
  80.  
  81. <br>A string can be changed in place
  82. <p>   s[4:6] = " hello "
  83. <p>A list can be appended at the end and at the beginning
  84. <p>  every put(listA, !listB)
  85. <p>But does the language definition forbid
  86. <p>  listA[5+:0] := listB
  87. <p>or what is the handy way to delete and insert elements
  88. <br>in a list supplied as an argument? If I have
  89. <p>  procedure f(mylist)
  90. <p>     put(mylist, "hello") # This is OK
  91. <br>     mylist[5+:0] := ["hello"] # Run time error.
  92. The book states
  93. <br>    #  that run time error is indeed expected.
  94. <br>     mylist := mylist[1:5] ||| ["hello"] ||| mylist[5:0] 
  95. # Here the caller is not affected!
  96. <p>1) Have I understood? Is it impossible to write a routine listinsert(A,B,i)
  97. <br>     and that we have to write A:=listinsert(A,B,i)
  98. <br>2) What was the language design objectives to rule out
  99. <br>           
  100. listA[i:j] := listB
  101. <br>      There is no semantic problem , listA[i]
  102. is an element and listA[i+:1] is a
  103. <br>      sublist (or rather today only a list
  104. of its own since it cannot be a left-value).
  105. <br>3) I figure there are dark corners here since I saw in a list library
  106. that
  107. <br>     mr Griswold himself thought about the difficulties
  108. in similarity/differences
  109. <br>     between string filosophy and list filosophy.
  110. <p>Comments anybody?
  111. <p>(the code is from top of my head, I only have Icon at home just now)
  112. <p>Andy
  113. <pre>-- 
  114. __________________________________________________________________
  115. Anders Holtsberg        Matematisk statistik   Telefon 046-2224953 
  116. andersh@maths.lth.se    Matematikcentrum       Telefax 046-2224998
  117. www.maths.lth.se        Lunds universitet      Box 118, 22100 Lund</pre>
  118.  </html>
  119.  
  120. --------------2D064CE7C06019CDC4A897F9--
  121.  
  122.